var momObject=function () {
	this.x;
	this.y;
	this.angle;
	
	this.momTailTime=0;
	this.momTailCount=0;
	
	this.momEyeTime=0;
	this.momEyeCount=0;
	this.momEyeInterval=1000;
	this.momBodyCount=0;
	
//	this.bigEye=new Image();
//	this.bigBody=new Image();
//	this.bigTill=new Image();
}

momObject.prototype.init=function () {
	 this.x=canWidth*0.5;
	 this.y=canHeight*0.5;
	 this.angle=0;
//	 this.bigEye.src="img/bigEye0.png";
//	 this.bigBody.src="img/bigSwim0.png";
//	 this.bigTill.src="img/bigTail0.png";
}
momObject.prototype.draw=function () {
	this.x=lerpDistance(mx,this.x,0.98);
	this.y=lerpDistance(my,this.y,0.98);
	
	var deltaY=this.y-my;
	var deltaX=this.x-mx;
	var beta=Math.atan2(deltaY,deltaX);//这个的返回值在-PI到PI之间
	
	this.angle=lerpAngle(beta,this.angle,0.6);
	//大鱼尾巴计数
	this.momTailTime+=deltaTime;
	if(this.momTailTime>50){
		this.momTailCount=(this.momTailCount+1)%8;
		this.momTailTime%=50;
	}
	//大鱼眼睛计数
	this.momEyeTime+=deltaTime;
	if(this.momEyeTime>this.momEyeInterval){
		this.momEyeCount=(this.momEyeCount+1) % 2;
		this.momEyeTime%=this.momEyeInterval;
		if(this.momEyeCount==0){
			this.momEyeInterval=Math.random()*1500+2000;
		}else{
			this.momEyeInterval=200;
		}
	}
	
	context1.save();
	context1.translate(this.x,this.y);
	context1.rotate(this.angle);
	var momEyeCount=this.momEyeCount;
	context1.drawImage(momEyes[momEyeCount],-momEyes[momEyeCount].width*0.5,-momEyes[momEyeCount].height*0.5);
	
	var momBodyCount=this.momBodyCount;
	if(data.double==1){//如果吃到橙色果实，身体就变橙色
		context1.drawImage(momBodyOranges[momBodyCount],-momBodyOranges[momBodyCount].width*0.5,-momBodyOranges[momBodyCount].height*0.5);
	}else{//如果吃到蓝色果实，身体就变蓝色
		context1.drawImage(momBodyBlues[momBodyCount],-momBodyBlues[momBodyCount].width*0.5,-momBodyBlues[momBodyCount].height*0.5);
	}
	
	
	var momTailCount=this.momTailCount;
	context1.drawImage(momTails[momTailCount],-momTails[momTailCount].width*0.5+30,-momTails[momTailCount].height*0.5);
    
    context1.restore();
}